//
//  HeadInsuranceCell.m
//  carcareIOS
//
//  Created by tianxing on 16/3/18.
//  Copyright © 2016年 chezheng. All rights reserved.
//
#define  cellHeight   84
#import "HomePageH5Cell.h"

@interface HomePageH5Cell()

@property (nonatomic, strong) UIImageView *iconImage;
@property (nonatomic, strong) UILabel *titleL;
@property (nonatomic, strong) UILabel *describeL;

@end

@implementation HomePageH5Cell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = [Theme backGroundColor];
        // 背景图片
        UIView *bgView = [[UIView viewWithFrame:CGRectMake(0, 7, __MAIN_WIDTH, cellHeight - 7)] setupOnView:self];
        bgView.backgroundColor = [UIColor whiteColor];
        self.iconImage = [Factory imageViewWithFrame:CGRectMake(0, 0, 38, 38) image:nil onView:self];
        self.iconImage.centerY = bgView.centerY;
        self.iconImage.left = self.left + 12 * __MAIN_RATIO_375;
        self.titleL = [Factory labelWithFrame:CGRectMake(0, 0, 150 * __MAIN_RATIO_375, 15) font:FONT_DEFAULT_Light(15) text:nil textColor:nil onView:self textAlignment:NSTextAlignmentLeft];
        self.titleL.top = self.iconImage.top;
        self.titleL.left =  self.iconImage.right + 9 * __MAIN_RATIO_375 ;
        self.describeL = [Factory labelWithFrame:CGRectMake(0, 0, __MAIN_WIDTH - 100, 15) font:FONT_DEFAULT_Light(13) text:nil textColor:COLOR_HEXSTRING(@"#949494") onView:self textAlignment:NSTextAlignmentLeft];
        self.describeL.bottom = self.iconImage.bottom;
        self.describeL.left = self.iconImage.right + 9 * __MAIN_RATIO_375;
        //进入图标
        [Factory imageViewWithCenter:CGPointMake(__MAIN_WIDTH  - 30 * __MAIN_RATIO_375, bgView.centerY) image:ImageNamed(@"Home_enter") onView:self];
        
    }
    return self;
}

-(void)setModel:(AdverticePageModel *)model{
    _model = model;
    if (model.localImage) {
        self.iconImage.image = model.localImage;
    }else{
        [self.iconImage setImageWithURL:[NSURL URLWithString:model.img]];
    }
    self.titleL.text = model.title;
    self.describeL.text = model.subTitle;
}

+ (CGFloat)heightForCell{
    
    return cellHeight;
}

@end
